package com.example.gymmanagement.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 
 * @TableName user
 */
@TableName(value ="user")
@Data
public class User implements Serializable {
    /**
     * 用户学号/工号
     */
    @TableId(value = "user_num",type=IdType.AUTO)
    private Long userNum;

    /**
     * 用户名
     */
    @TableField(value = "user_name")
    private String userName;

    /**
     * 用户权限（数组）
     */
    @TableField(value = "user_auth")
    private String userAuth;

    /**
     * 用户邮箱
     */
    @TableField(value = "user_email")
    private String userEmail;

    /**
     * 用户密码
     */
    @TableField(value = "user_password")
    private String userPassword;

    /**
     * 用户头像
     */
    @TableField(value = "user_icon")
    private Long userIcon;

    /**
     * 用户信誉（赔偿、失约扣除）
     */
    @TableField(value = "user_cred")
    private Integer userCred;

    /**
     * 用户创建时间
     */
    @TableField(value = "user_createtime")
    private LocalDateTime userCreatetime;

    /**
     * 用户更新时间
     */
    @TableField(value = "user_updatetime")
    private LocalDateTime userUpdatetime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getUserNum() == null ? other.getUserNum() == null : this.getUserNum().equals(other.getUserNum()))
            && (this.getUserName() == null ? other.getUserName() == null : this.getUserName().equals(other.getUserName()))
            && (this.getUserAuth() == null ? other.getUserAuth() == null : this.getUserAuth().equals(other.getUserAuth()))
            && (this.getUserEmail() == null ? other.getUserEmail() == null : this.getUserEmail().equals(other.getUserEmail()))
            && (this.getUserPassword() == null ? other.getUserPassword() == null : this.getUserPassword().equals(other.getUserPassword()))
            && (this.getUserIcon() == null ? other.getUserIcon() == null : this.getUserIcon().equals(other.getUserIcon()))
            && (this.getUserCred() == null ? other.getUserCred() == null : this.getUserCred().equals(other.getUserCred()))
            && (this.getUserCreatetime() == null ? other.getUserCreatetime() == null : this.getUserCreatetime().equals(other.getUserCreatetime()))
            && (this.getUserUpdatetime() == null ? other.getUserUpdatetime() == null : this.getUserUpdatetime().equals(other.getUserUpdatetime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUserNum() == null) ? 0 : getUserNum().hashCode());
        result = prime * result + ((getUserName() == null) ? 0 : getUserName().hashCode());
        result = prime * result + ((getUserAuth() == null) ? 0 : getUserAuth().hashCode());
        result = prime * result + ((getUserEmail() == null) ? 0 : getUserEmail().hashCode());
        result = prime * result + ((getUserPassword() == null) ? 0 : getUserPassword().hashCode());
        result = prime * result + ((getUserIcon() == null) ? 0 : getUserIcon().hashCode());
        result = prime * result + ((getUserCred() == null) ? 0 : getUserCred().hashCode());
        result = prime * result + ((getUserCreatetime() == null) ? 0 : getUserCreatetime().hashCode());
        result = prime * result + ((getUserUpdatetime() == null) ? 0 : getUserUpdatetime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", userNum=").append(userNum);
        sb.append(", userName=").append(userName);
        sb.append(", userAuth=").append(userAuth);
        sb.append(", userEmail=").append(userEmail);
        sb.append(", userPassword=").append(userPassword);
        sb.append(", userIcon=").append(userIcon);
        sb.append(", userCred=").append(userCred);
        sb.append(", userCreatetime=").append(userCreatetime);
        sb.append(", userUpdatetime=").append(userUpdatetime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}